(function(){
	var $content=$('#content');
//	box1设置高度
	var $box1=$content.find('.box1');
	height();
	$(window).resize(height);
	function height(){
		var height=$(window).height()-parseFloat($content.css('marginTop'));
	    $box1.height(height);
	}
	
//	绿色按钮点击
  var $btn=$('.btn');
  $btn.click(function(){
  	var id=this.dataset.id;
  	var $header=$('header').height();
  	var  top= id==1? $('.box2').offset().top-$header-($(window).height()-$header-$('.box2').height())/2
  	                 : $('.bg2').offset().top-$header;
  	$('body,html').animate({
  		scrollTop:top	
  	},1000);
  });
	
})();
